package adapter.objectadapter;

/**
 * @Author liangliangzhao
 * @data 2023/3/27 15:55
 */

public class VoltageAdapter implements IVoItage5V {

    private Voltage220V voltage220V;

    public VoltageAdapter(Voltage220V voltage220V){
        super();
        this.voltage220V = voltage220V;
    }

    @Override
    public int output5V() {
        int dsV = 0;
        if(null != voltage220V){
            //获取到220V电压
            int srcV = voltage220V.output220();
            System.out.println("使用对象适配器,进行适配~~");
            dsV = srcV / 44;//转换成5v
            System.out.println("适配完成,输出的电压为="+dsV);
        }
        return dsV;
    }
}
